package com.oauth.extensions.client.ui;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

public class Header extends Composite {

	private static HeaderUiBinder uiBinder = GWT.create(HeaderUiBinder.class);

	interface HeaderUiBinder extends UiBinder<Widget, Header> {
	}

	@UiField
	Anchor siteAnchor;

	@UiField
	Label userName;

	public Header() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	public void setUserName(String userName) {
		this.userName.setText(userName);
	}

	@UiHandler("siteAnchor")
	void onClick(ClickEvent e) {
		Window.open("http://www.rapwaves.com/", "OAuth Home", null);
	}
}
